package com.example.demo.Service;

import com.example.demo.Mapper.CartMapper;
import com.example.demo.Pojo.CartDTO;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.yaml.snakeyaml.events.Event;

import java.util.List;
//返回购书车商品初始化渲染的数据
@Service
public class CartServiceImpl implements CartService {

    @Resource
    public CartMapper cartMapper;

    //购物车删除商品
    @Override
    public CartDTO delete(CartDTO cartDTO) {

        cartMapper.show();

        return null;
    }


    //购物车支付商品
    @Override
    public void pay(CartDTO cartDTO) {
        int id =cartDTO.getId();
        cartMapper.delete(id);
    }


    //购物车显示
    @Override
    public List<CartDTO> show() {

        List<CartDTO> cartDTO = cartMapper.show();

        return cartDTO;
    }

}
